<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>关于响应 | 课程简介</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    
    <link rel="prev" href="../C05-Flask-RESTful/AboutRequest.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="6.4"
        data-chapter-title="关于响应"
        data-filepath="C05-Flask-RESTful/AboutResponse.md"
        data-basepath=".."
        data-revision="Sat May 11 2019 20:06:35 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        课程简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="AboutFlask.html">
            
                
                    <a href="../AboutFlask.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Flask介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="C01-CreateProject/index.html">
            
                
                    <a href="../C01-CreateProject/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        工程搭建
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="C01-CreateProject/EnvInstall.html">
            
                
                    <a href="../C01-CreateProject/EnvInstall.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        环境安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="C01-CreateProject/HelloWorld.html">
            
                
                    <a href="../C01-CreateProject/HelloWorld.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        HelloWorld程序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="C01-CreateProject/AboutParams.html">
            
                
                    <a href="../C01-CreateProject/AboutParams.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        参数说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="C01-CreateProject/StartDevelopmentServer.html">
            
                
                    <a href="../C01-CreateProject/StartDevelopmentServer.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        开发服务器运行方式
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="C02-RouterAndBlueprint/index.html">
            
                
                    <a href="../C02-RouterAndBlueprint/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        路由与蓝图
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="C02-RouterAndBlueprint/Router.html">
            
                
                    <a href="../C02-RouterAndBlueprint/Router.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        路由
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="C02-RouterAndBlueprint/Blueprint.html">
            
                
                    <a href="../C02-RouterAndBlueprint/Blueprint.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        蓝图
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="C03-RequestAndResponse/index.html">
            
                
                    <a href="../C03-RequestAndResponse/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        请求与响应
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="C03-RequestAndResponse/HandleRequest.html">
            
                
                    <a href="../C03-RequestAndResponse/HandleRequest.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        处理请求
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="C03-RequestAndResponse/HandleResponse.html">
            
                
                    <a href="../C03-RequestAndResponse/HandleResponse.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        处理响应
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="C03-RequestAndResponse/CookieAndSession.html">
            
                
                    <a href="../C03-RequestAndResponse/CookieAndSession.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        Cookie与Session
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="C04-HookAndContext/index.html">
            
                
                    <a href="../C04-HookAndContext/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        请求钩子与上下文
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="C04-HookAndContext/AbortAndErrorhandler.html">
            
                
                    <a href="../C04-HookAndContext/AbortAndErrorhandler.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        异常处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="C04-HookAndContext/Hook.html">
            
                
                    <a href="../C04-HookAndContext/Hook.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        请求钩子
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="C04-HookAndContext/Context.html">
            
                
                    <a href="../C04-HookAndContext/Context.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        上下文
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="C05-Flask-RESTful/index.html">
            
                
                    <a href="../C05-Flask-RESTful/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        Flask-RESTful
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="C05-Flask-RESTful/QuickStart.html">
            
                
                    <a href="../C05-Flask-RESTful/QuickStart.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        起步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="C05-Flask-RESTful/AboutView.html">
            
                
                    <a href="../C05-Flask-RESTful/AboutView.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        关于视图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="C05-Flask-RESTful/AboutRequest.html">
            
                
                    <a href="../C05-Flask-RESTful/AboutRequest.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        关于请求
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="6.4" data-path="C05-Flask-RESTful/AboutResponse.html">
            
                
                    <a href="../C05-Flask-RESTful/AboutResponse.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        关于响应
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >课程简介</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5173;&#x4E8E;&#x54CD;&#x5E94;&#x5904;&#x7406;">&#x5173;&#x4E8E;&#x54CD;&#x5E94;&#x5904;&#x7406;</h1>
<h2 id="1-&#x5E8F;&#x5217;&#x5316;&#x6570;&#x636E;">1 &#x5E8F;&#x5217;&#x5316;&#x6570;&#x636E;</h2>
<p>Flask-RESTful &#x63D0;&#x4F9B;&#x4E86;marshal&#x5DE5;&#x5177;&#xFF0C;&#x7528;&#x6765;&#x5E2E;&#x52A9;&#x6211;&#x4EEC;&#x5C06;&#x6570;&#x636E;&#x5E8F;&#x5217;&#x5316;&#x4E3A;&#x7279;&#x5B9A;&#x683C;&#x5F0F;&#x7684;&#x5B57;&#x5178;&#x6570;&#x636E;&#xFF0C;&#x4EE5;&#x4FBF;&#x4F5C;&#x4E3A;&#x89C6;&#x56FE;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x3002;</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> flask_restful <span class="hljs-keyword">import</span> Resource, fields, marshal_with

resource_fields = {
    <span class="hljs-string">&apos;name&apos;</span>: fields.String,
    <span class="hljs-string">&apos;address&apos;</span>: fields.String,
    <span class="hljs-string">&apos;user_id&apos;</span>: fields.Integer
}

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Todo</span><span class="hljs-params">(Resource)</span>:</span>
<span class="hljs-decorator">    @marshal_with(resource_fields, envelope=&apos;resource&apos;)</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self, **kwargs)</span>:</span>
        <span class="hljs-keyword">return</span> db_get_todo()
</code></pre>
<p>&#x4E5F;&#x53EF;&#x4EE5;&#x4E0D;&#x4F7F;&#x7528;&#x88C5;&#x9970;&#x5668;&#x7684;&#x65B9;&#x5F0F;</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Todo</span><span class="hljs-params">(Resource)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self, **kwargs)</span>:</span>
        data = db_get_todo()
        <span class="hljs-keyword">return</span> marshal(data, resource_fields)
</code></pre>
<h4 id="&#x793A;&#x4F8B;">&#x793A;&#x4F8B;</h4>
<pre><code class="lang-python"><span class="hljs-comment"># &#x7528;&#x6765;&#x6A21;&#x62DF;&#x8981;&#x8FD4;&#x56DE;&#x7684;&#x6570;&#x636E;&#x5BF9;&#x8C61;&#x7684;&#x7C7B;</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">User</span><span class="hljs-params">(object)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, user_id, name, age)</span>:</span>
        self.user_id = user_id
        self.name = name
        self.age = age

resoure_fields = {
        <span class="hljs-string">&apos;user_id&apos;</span>: fields.Integer,
        <span class="hljs-string">&apos;name&apos;</span>: fields.String
    }

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Demo1Resource</span><span class="hljs-params">(Resource)</span>:</span>
<span class="hljs-decorator">    @marshal_with(resoure_fields, envelope=&apos;data1&apos;)</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self)</span>:</span>
        user = User(<span class="hljs-number">1</span>, <span class="hljs-string">&apos;itcast&apos;</span>, <span class="hljs-number">12</span>)
        <span class="hljs-keyword">return</span> user

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Demo2Resource</span><span class="hljs-params">(Resource)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self)</span>:</span>
        user = User(<span class="hljs-number">1</span>, <span class="hljs-string">&apos;itcast&apos;</span>, <span class="hljs-number">12</span>)
        <span class="hljs-keyword">return</span> marshal(user, resoure_fields, envelope=<span class="hljs-string">&apos;data2&apos;</span>)
</code></pre>
<h2 id="2-&#x5B9A;&#x5236;&#x8FD4;&#x56DE;&#x7684;json&#x683C;&#x5F0F;">2 &#x5B9A;&#x5236;&#x8FD4;&#x56DE;&#x7684;JSON&#x683C;&#x5F0F;</h2>
<h3 id="&#x9700;&#x6C42;">&#x9700;&#x6C42;</h3>
<p>&#x60F3;&#x8981;&#x63A5;&#x53E3;&#x8FD4;&#x56DE;&#x7684;JSON&#x6570;&#x636E;&#x5177;&#x6709;&#x5982;&#x4E0B;&#x7EDF;&#x4E00;&#x7684;&#x683C;&#x5F0F;</p>
<pre><code class="lang-json">{<span class="hljs-string">&quot;message&quot;</span>: <span class="hljs-string">&quot;&#x63CF;&#x8FF0;&#x4FE1;&#x606F;&quot;</span>, <span class="hljs-string">&quot;data&quot;</span>: {&#x8981;&#x8FD4;&#x56DE;&#x7684;&#x5177;&#x4F53;&#x6570;&#x636E;}}
</code></pre>
<p>&#x5728;&#x63A5;&#x53E3;&#x5904;&#x7406;&#x6B63;&#x5E38;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C; message&#x8FD4;&#x56DE;ok&#x5373;&#x53EF;&#xFF0C;&#x4F46;&#x662F;&#x82E5;&#x60F3;&#x6BCF;&#x4E2A;&#x63A5;&#x53E3;&#x6B63;&#x786E;&#x8FD4;&#x56DE;&#x65F6;&#x7701;&#x7565;message&#x5B57;&#x6BB5;</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DemoResource</span><span class="hljs-params">(Resource)</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self)</span>:</span>
        <span class="hljs-keyword">return</span> {<span class="hljs-string">&apos;user_id&apos;</span>:<span class="hljs-number">1</span>, <span class="hljs-string">&apos;name&apos;</span>: <span class="hljs-string">&apos;itcast&apos;</span>}
</code></pre>
<p>&#x5BF9;&#x4E8E;&#x8BF8;&#x5982;&#x6B64;&#x7C7B;&#x7684;&#x63A5;&#x53E3;&#xFF0C;&#x80FD;&#x5426;&#x5728;&#x67D0;&#x5904;&#x7EDF;&#x4E00;&#x683C;&#x5F0F;&#x5316;&#x6210;&#x4E0A;&#x8FF0;&#x9700;&#x6C42;&#x683C;&#x5F0F;&#xFF1F;</p>
<pre><code class="lang-json">{<span class="hljs-string">&quot;message&quot;</span>: <span class="hljs-string">&quot;OK&quot;</span>, <span class="hljs-string">&quot;data&quot;</span>: {<span class="hljs-string">&apos;user_id&apos;</span>:<span class="hljs-number">1</span>, <span class="hljs-string">&apos;name&apos;</span>: <span class="hljs-string">&apos;itcast&apos;</span>}}
</code></pre>
<h3 id="&#x89E3;&#x51B3;">&#x89E3;&#x51B3;</h3>
<p><strong>Flask-RESTful&#x7684;Api&#x5BF9;&#x8C61;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;<code>representation</code>&#x7684;&#x88C5;&#x9970;&#x5668;&#xFF0C;&#x5141;&#x8BB8;&#x5B9A;&#x5236;&#x8FD4;&#x56DE;&#x6570;&#x636E;&#x7684;&#x5448;&#x73B0;&#x683C;&#x5F0F;</strong></p>
<pre><code class="lang-python">api = Api(app)

<span class="hljs-decorator">@api.representation(&apos;application/json&apos;)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">handle_json</span><span class="hljs-params">(data, code, headers)</span>:</span>
    <span class="hljs-comment"># TODO &#x6B64;&#x5904;&#x6DFB;&#x52A0;&#x81EA;&#x5B9A;&#x4E49;&#x5904;&#x7406;</span>
    <span class="hljs-keyword">return</span> resp
</code></pre>
<p>Flask-RESTful&#x539F;&#x59CB;&#x5BF9;&#x4E8E;json&#x7684;&#x683C;&#x5F0F;&#x5904;&#x7406;&#x65B9;&#x5F0F;&#x5982;&#x4E0B;&#xFF1A;</p>
<p>&#x4EE3;&#x7801;&#x51FA;&#x5904;&#xFF1A;<code>flask_restful.representations.json</code></p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> flask <span class="hljs-keyword">import</span> make_response, current_app
<span class="hljs-keyword">from</span> flask_restful.utils <span class="hljs-keyword">import</span> PY3
<span class="hljs-keyword">from</span> json <span class="hljs-keyword">import</span> dumps


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">output_json</span><span class="hljs-params">(data, code, headers=None)</span>:</span>
    <span class="hljs-string">&quot;&quot;&quot;Makes a Flask response with a JSON encoded body&quot;&quot;&quot;</span>

    settings = current_app.config.get(<span class="hljs-string">&apos;RESTFUL_JSON&apos;</span>, {})

    <span class="hljs-comment"># If we&apos;re in debug mode, and the indent is not set, we set it to a</span>
    <span class="hljs-comment"># reasonable value here.  Note that this won&apos;t override any existing value</span>
    <span class="hljs-comment"># that was set.  We also set the &quot;sort_keys&quot; value.</span>
    <span class="hljs-keyword">if</span> current_app.debug:
        settings.setdefault(<span class="hljs-string">&apos;indent&apos;</span>, <span class="hljs-number">4</span>)
        settings.setdefault(<span class="hljs-string">&apos;sort_keys&apos;</span>, <span class="hljs-keyword">not</span> PY3)

    <span class="hljs-comment"># always end the json dumps with a new line</span>
    <span class="hljs-comment"># see https://github.com/mitsuhiko/flask/pull/1262</span>
    dumped = dumps(data, **settings) + <span class="hljs-string">&quot;\n&quot;</span>

    resp = make_response(dumped, code)
    resp.headers.extend(headers <span class="hljs-keyword">or</span> {})
    <span class="hljs-keyword">return</span> resp
</code></pre>
<p>&#x4E3A;&#x6EE1;&#x8DB3;&#x9700;&#x6C42;&#xFF0C;&#x505A;&#x5982;&#x4E0B;&#x6539;&#x52A8;&#x5373;&#x53EF;</p>
<pre><code class="lang-python"><span class="hljs-decorator">@api.representation(&apos;application/json&apos;)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">output_json</span><span class="hljs-params">(data, code, headers=None)</span>:</span>
    <span class="hljs-string">&quot;&quot;&quot;Makes a Flask response with a JSON encoded body&quot;&quot;&quot;</span>

    <span class="hljs-comment"># &#x6B64;&#x5904;&#x4E3A;&#x81EA;&#x5DF1;&#x6DFB;&#x52A0;***************</span>
    <span class="hljs-keyword">if</span> <span class="hljs-string">&apos;message&apos;</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> data:
        data = {
            <span class="hljs-string">&apos;message&apos;</span>: <span class="hljs-string">&apos;OK&apos;</span>,
            <span class="hljs-string">&apos;data&apos;</span>: data
        }
    <span class="hljs-comment"># **************************</span>

    settings = current_app.config.get(<span class="hljs-string">&apos;RESTFUL_JSON&apos;</span>, {})

    <span class="hljs-comment"># If we&apos;re in debug mode, and the indent is not set, we set it to a</span>
    <span class="hljs-comment"># reasonable value here.  Note that this won&apos;t override any existing value</span>
    <span class="hljs-comment"># that was set.  We also set the &quot;sort_keys&quot; value.</span>
    <span class="hljs-keyword">if</span> current_app.debug:
        settings.setdefault(<span class="hljs-string">&apos;indent&apos;</span>, <span class="hljs-number">4</span>)
        settings.setdefault(<span class="hljs-string">&apos;sort_keys&apos;</span>, <span class="hljs-keyword">not</span> PY3)

    <span class="hljs-comment"># always end the json dumps with a new line</span>
    <span class="hljs-comment"># see https://github.com/mitsuhiko/flask/pull/1262</span>
    dumped = dumps(data, **settings) + <span class="hljs-string">&quot;\n&quot;</span>

    resp = make_response(dumped, code)
    resp.headers.extend(headers <span class="hljs-keyword">or</span> {})
    <span class="hljs-keyword">return</span> resp
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../C05-Flask-RESTful/AboutRequest.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 关于请求"><i class="fa fa-angle-left"></i></a>
        
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
